package com.org.devg.devgfilesync.web.file.service.impl;

import com.org.devg.devgfilesync.web.file.dao.FileMapper;
import com.org.devg.devgfilesync.web.file.service.FileService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FileServiceImpl implements FileService {

  @Autowired
  private FileMapper fileMapper;

  @Override
  public Map<String, Object> getSyncConfig(Map<String, Object> params) {
    List<Map<String, Object>> syncConfigList = fileMapper.getSyncConfigList(params);
    if (null != syncConfigList && syncConfigList.size() > 0) {
      return syncConfigList.get(0);
    }
    return null;
  }

  @Override
  public int updateSyncRun(String syncConfigName) {
    return fileMapper.updateSyncRun(syncConfigName);
  }

  @Override
  public int updateSyncStop(String syncConfigName) {
    return fileMapper.updateSyncStop(syncConfigName);
  }

  @Override
  public int updateSyncStatus(Map<String,Object> fileMap) {
    return fileMapper.updateSyncStatus(fileMap);
  }

  @Override
  public List<Map<String, Object>> selectFileList(Integer thePreSyncNum) {
    return fileMapper.selectFileList(thePreSyncNum);
  }
}
